<template>
  <div>
    <el-form ref="form" :model="form" label-width="80px" inline style="margin-top: 50px">
      <el-form-item label="时间">
        <el-date-picker
          v-model="value"
          type="datetimerange"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">筛选</el-button>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="addDialogVisible=true">新建</el-button>
      </el-form-item>
    </el-form>
    <el-table
      :data="tableData"
      style="width: 95%;margin-left: 30px"
      border
    >
      <!--      <el-table-column type="expand">-->
      <!--        <template slot-scope="props">-->
      <!--          <el-form label-position="left" inline class="demo-table-expand">-->
      <!--            <el-form-item label="名称" style="display: block">-->
      <!--              <span>{{ props.row.name }}</span>-->
      <!--            </el-form-item>-->
      <!--            <el-form-item label="描述" style="display: block">-->
      <!--              <span>{{ temp.text }}</span>-->
      <!--            </el-form-item>-->
      <!--            <el-form-item label="单价" style="display: block">-->
      <!--              <span>{{ temp.price }}</span>-->
      <!--            </el-form-item>-->
      <!--            <el-form-item label="总销售数量" style="display: block">-->
      <!--              <span>{{ props.row.address }}</span>-->
      <!--            </el-form-item>-->
      <!--          </el-form>-->
      <!--        </template>-->
      <!--      </el-table-column>-->
      <el-table-column
        prop="name"
        label="时间"
        width="180"
      />
      <el-table-column
        prop="address"
        label="任务额"
      />
      <el-table-column
        prop="address"
        label="任务客户数"
      />
      <el-table-column
        label="操作"
        width="180"
      >
        <template slot-scope="scope">
          <el-button type="text" @click="showDetail(scope.row)">详情</el-button>
          <el-button type="text" @click="handleClick(scope.row)">编辑</el-button>
          <el-button type="text">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-dialog
      :visible.sync="centerDialogVisible"
      title="课程详情"
      left
    >
      <el-form :model="form">
        <el-form-item label="名称" label-width="100px">
          <!--          <el-input v-model="form.name" autocomplete="off" readonly width="120px"></el-input>-->
          {{ form.name }}
        </el-form-item>
        <el-form-item label="描述" label-width="100px" readonly>
          <!--          <el-input v-model="form.text" autocomplete="off" width="150px" readonly />-->
          {{ form.text }}
        </el-form-item>
        <el-form-item label="单价" label-width="100px" readonly>
          <!--          <el-input v-model="form.price" autocomplete="off" width="150px" readonly />-->
          {{ form.price }}
        </el-form-item>
        <el-form-item label="总销售数量" label-width="100px" readonly>
          <!--          <el-input v-model="form.num" autocomplete="off" width="150px" readonly />-->
          {{ form.num }}
        </el-form-item>
      </el-form>
      <span slot="footer">
        <el-button @click="centerDialogVisible = false">确定</el-button>
      </span>
    </el-dialog>

    <!--    添加功能-->
    <el-dialog
      :visible.sync="addDialogVisible"
      title="新建营销任务"
      left
      width="30%"
    >
      <el-form :model="form">
        <el-form-item label="开始日期" label-width="100px">
          <div class="block">
            <el-date-picker
              v-model="value1"
              type="date"
              placeholder="选择日期"
              style="width: 80%"
            />
          </div>
        </el-form-item>
        <el-form-item label="结束日期" label-width="100px">
          <div class="block">
            <el-date-picker
              v-model="value1"
              type="date"
              placeholder="选择日期"
              style="width: 80%"
            />
          </div>
        </el-form-item>
        <el-form-item label="业务员" label-width="100px">
          <el-select v-model="temp.type" multiple class="filter-item" style="width: 80%" placeholder="选择业务员">
            <el-option label="冯先生" value="1" />
            <el-option label="张先生" value="2" />
            <el-option label="李先生 " value="3" />
          </el-select>
        </el-form-item>
        <el-form-item label="销售额" label-width="100px">
          <el-input v-model="form.addSaleNum" style="width: 80%" placeholder="请输入销售额" />
        </el-form-item>
        <el-form-item label="联系客户数" label-width="100px">
          <el-input v-model="form.addSaleMan" style="width: 80%" placeholder="请输入联系客户数" />
        </el-form-item>
        <el-form-item label="随机分配" label-width="100px">
          <el-radio v-model="radio" label="1">是</el-radio>
          <el-radio v-model="radio" label="2">否</el-radio>
        </el-form-item>
      </el-form>
      <span slot="footer">
        <el-button @click="addDialogVisible = false">添加</el-button>
        <el-button @click="addDialogVisible = false">取消</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<!--import $router from "element-ui/packages/col/src/col";-->
<script>

export default {
  name: 'Index',
  data() {
    return {
      value: '',
      value1: '',
      radio: '1',
      centerDialogVisible: false,
      addDialogVisible: false,
      form: {
        region: '1',
        name: '拉拉啦',
        addname: '',
        addnum: '',
        addprice: '',
        addtext: '',
        addSaleNum: '',
        addSaleMan: '',
        num: '100',
        price: '100',
        text: '好东西',
        teacher: ''
      },
      temp: {
        text: 'dsdad',
        price: 'dsda'
      },
      tableData: [{
        name: '2020-11',
        address: '1000'
      }, {
        name: '2020-10',
        address: '2040'
      }, {
        name: '2020-9',
        address: '1'
      }, {
        name: '2019-8',
        address: '222'
      }]
    }
  },
  methods: {
    showDetail(row) {
      this.$router.push({ name: 'saleDetail', path: 'saleDetail', query: { date: 'name' }})
    }
  }
}
</script>

<style scoped>
</style>

